# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

# NOTE: python-apt must be available system-wide as it can't be installed
# by pip, alternatively you must list it as an external dependency
# with an URL like this one:
# http://snapshot.debian.org/archive/debian/20130606T215913Z/pool/main/p/python-apt/python-apt_0.8.9.1.tar.gz

[tox]
envlist =
    {py27,py34,py35}-{django18,django19,django110}-unit-tests,
    flake8,
# Ensure we have no warnings on last Django LTS
    py35-django18-no-warnings
skipsdist = True
skip_missing_interpreters = True

[testenv]
whitelist_externals =
    tox
commands =
    unit-tests: {envpython} ./manage.py test django_email_accounts distro_tracker
    no-warnings: {envpython} -W error -W ignore:::site: ./manage.py test django_email_accounts distro_tracker
    show-warnings: {envpython} -W all ./manage.py test django_email_accounts distro_tracker
    functional-tests: {envpython} ./manage.py test functional_tests/
    check: {envpython} ./manage.py check
sitepackages = True
deps =
    django18: Django>=1.8,<1.9
    django19: Django>=1.9,<1.10
    django110: Django>=1.10,<1.11
    functional: Django>=1.8,<1.9
    coverage: coverage
    py27-tests: mock
    py27-tests: pyliblzma
    py27-tests: SOAPpy
    py27-tests: python_ldap
    tests: requests
    tests: django_jsonfield
    tests: django_debug_toolbar
    tests: pygpgme
    tests: PyYAML
    tests: python_debian
    tests: python_apt
    tests: beautifulsoup4
    functional-tests: selenium



[testenv:flake8]
commands = {envpython} -m flake8 django_email_accounts/ functional_tests/ distro_tracker/
deps =
    flake8

[flake8]
max-complexity = 12
max-line-length = 80
exclude = .git,.ropeproject,__pycache__,distro_tracker/project/settings/local.py,*/migrations/*.py
ignore = N813,N806,N802

[testenv:coverage]
basepython = python2.7
commands = 
    {envpython} -m coverage erase
    tox -e py27-coverage
    tox -e py35-coverage
    {envpython} -m coverage combine
    {envpython} -m coverage html

[testenv:py27-coverage]
commands = {envpython} -m coverage run -p ./manage.py test django_email_accounts distro_tracker

[testenv:py35-coverage]
commands = {envpython} -m coverage run -p ./manage.py test django_email_accounts distro_tracker
